Skip to content

Add permanently_remove support to project delete#1110

Open
msrouchou wants to merge 4 commits into
mainfrom
feature/project-permanently-remove
Open

Add permanently_remove support to project delete#1110
msrouchou wants to merge 4 commits into
mainfrom
feature/project-permanently-remove

Conversation

@msrouchou

Copy link
Copy Markdown
Contributor

Exposes the permanently_remove and full_path query parameters on IProjectClient.DeleteAsync, matching the GitLab API behavior where v18+ soft-deletes by default and requires an explicit flag to bypass the grace period.

https://docs.gitlab.com/api/projects/#delete-a-project

@msrouchou msrouchou requested a review from a team as a code owner June 25, 2026 21:20
@msrouchou msrouchou requested review from louis-z and removed request for a team and louis-z June 25, 2026 21:20
Exposes the permanently_remove and full_path query parameters on
IProjectClient.DeleteAsync, matching the GitLab API behavior where
v18+ soft-deletes by default and requires an explicit flag to bypass
the grace period.

https://docs.gitlab.com/api/projects/#delete-a-project
@louis-z louis-z force-pushed the feature/project-permanently-remove branch from bc5b29c to 065b10c Compare June 30, 2026 11:51

[Test]
public async Task DeleteAsync_WhenProjectExists_ItIsDeleted()
public async Task DeleteAsync_WhenProjectExists_ItIsMarkedForDeletion()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For better consistency with the additional test that follows this one:

Suggested change
public async Task DeleteAsync_WhenProjectExists_ItIsMarkedForDeletion()
public async Task DeleteAsync_WhenProjectExists_MarksProjectForDeletion()

// Assert
var markedProject = await projectClient.GetAsync(project.Id);
Assert.That(markedProject.MarkedForDeletionOn, Is.Not.Null);
Assert.That(markedProject.MarkedForDeletionOn!.Value.Date, Is.EqualTo(DateTime.UtcNow.Date));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How come deletion is scheduled for today? I'm assuming this is due to a server setting, but can you provide a comment that explains it?

var project = await projectClient.GetAsync(projectFullPath);

// First call: soft-mark
await projectClient.DeleteAsync(project.Id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this call really needed, especially since we don't assert anything after it? Besides, the soft delete path is already tested elsewhere.

var project = await projectClient.GetAsync(projectFullPath);

// Soft-mark first
await projectClient.DeleteAsync(project.Id);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again, why is this here?

Comment on lines +56 to +57
var @operator = url.Contains('?') ? "&" : "?";
url += $"{@operator}full_path={options.FullPath}";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
var @operator = url.Contains('?') ? "&" : "?";
url += $"{@operator}full_path={options.FullPath}";
url = Utils.AddParameter(url, "full_path", options.FullPath);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants